<?php
require_once('../includes/frameworkajax.php');
if(@!$_GET['term'])
exit;

$term = @$_GET['term'];
$sql = "select ci_item, ds_item from tethys.tb_itens
where ds_item ilike '%{$term}%'
order by 2 asc
limit 10";
$query = @Connection::query($sql);
$str = '[';
while($row = $query->fetch()){
	$str .= '{"id":"'.$row['ci_item'].'","label":"'.$row['ds_item'].'"},';
}
echo substr($str, 0, -1).']';
?>